<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var $block \Magento\Backend\Block\GlobalSearch */
?>
<div class="search-global" data-mage-init='{"globalSearch": {}}'>
    <form action="#" id="form-search">
        <div class="search-global-field">
            <label class="search-global-label" for="search-global"></label>
            <input
                    type="text"
                    class="search-global-input"
                    id="search-global"
                    name="query"
                    data-mage-init='<?php echo $block->escapeHtml($this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getWidgetInitOptions()))?>'>
            <button
                type="submit"
                class="search-global-action"
                title="<?php /* @escapeNotVerified */ echo __('Search') ?>"
                ></button>
        </div>
    </form>
    <script data-template="search-suggest" type="text/x-magento-template">
        <ul class="search-global-menu">
        <% if (data.items.length) { %>
            <% _.each(data.items, function(value){ %>
            <li class="item"
                <%- data.optionData(value) %>
                >
                <a href="<%- value.url %>" class="title"><%- value.name %></a>
                <span class="type"><%- value.type %></span>
                <%- value.description || "" %>
            </li>
            <% }); %>
        <% } else { %>
            <li>
                <span class="mage-suggest-no-records">
                    <?php /* @escapeNotVerified */ echo __('No records found.') ?>
                </span>
            </li>
        <% } %>
        </ul>
    </script>
</div>
